1 package org.smartcomps.twister.engine.core.definition;
2
3 import junit.framework.TestCase;
4 import net.sf.hibernate.tool.hbm2ddl.SchemaExport;
5 import net.sf.hibernate.cfg.Configuration;
6 import org.smartcomps.twister.common.transaction.TransactionManager;
7 import org.smartcomps.twister.common.lifecycle.LifecycleManager;
8 import org.smartcomps.twister.util.BeanTester;
9 import org.smartcomps.twister.engine.priv.core.definition.ActivityFactory;
10 import org.smartcomps.twister.engine.priv.core.definition.Empty;
11 import org.smartcomps.twister.engine.priv.core.definition.ProcessFactory;
12
13 import java.util.Date;
14 import java.util.Calendar;
15
16 import com.sun.msv.datatype.xsd.DatatypeFactory;
17
18 public class TestEmpty extends TestCase {
19
20 public static Empty empty = null;
21
22 private BeanTester beanTester = new BeanTester(new String[] {"Id", "Index"});
23 private TestProcess testProcess = new TestProcess();
24
25 protected void setUp() throws Exception {
26 LifecycleManager.getLifecycleManager().createResources();
27 LifecycleManager.getLifecycleManager().startResources();
28
29 SchemaExport schemaExport = new SchemaExport(new Configuration().configure());
30 schemaExport.create(true, true);
31
32 TransactionManager.beginTransaction();
33 testProcess.testCreate();
34 }
35
36 protected void tearDown() throws Exception {
37 TransactionManager.commitTransaction();
38
39 LifecycleManager.getLifecycleManager().stopResources();
40 LifecycleManager.getLifecycleManager().destroyResources();
41 }
42
43 public void testCreate() throws Exception {
44 empty = (Empty) ActivityFactory.createActivity(Empty.class, TestProcess.testProcess);
45 beanTester.initializeProperties("testEmpty", empty);
46
47 TransactionManager.commitTransaction();
48 TransactionManager.beginTransaction();
49
50 Empty resultEmpty = (Empty) ProcessFactory.getByName(TestProcess.testProcess.getName()).getActivity();
51 assertTrue("Empty attributes values have been changed.", beanTester.testValues("testEmpty", resultEmpty));
52 empty = resultEmpty;
53 }
54
55 }
This page was automatically generated by Maven